﻿using System;
using Microsoft.Samples.Cloud.Data;
using WaveTech.GShield.Model;
using WaveTech.GShield.Repositories.Azure.Entities;

namespace WaveTech.GShield.Repositories.Azure
{
	public static class CloudToModel
	{
		public static GameRating GetGameRating(SsdsEntity<CloudGameRating> cloudGameRating)
		{
			if (cloudGameRating == null)
			{
				return null;
			}

			GameRating gameRating = new GameRating()
			{
				GameRatingId = new Guid(cloudGameRating.Id),
				Title = cloudGameRating.Entity.Title,
				Publisher = cloudGameRating.Entity.Publisher,
				FileName = cloudGameRating.Entity.FileName,
				Directory = cloudGameRating.Entity.Directory,
				ProductName = cloudGameRating.Entity.ProductName,
				Rating = (RatingTypes)cloudGameRating.Entity.Rating
			};

			return gameRating;
		}
	}
}